<?php
// 获取用户基本信息
// header("content-type:text/html;charset=UTF-8");
include_once("conn.php");
include_once("u_getLoginInfo.php");

if (!isset($_GET['action'])) {
    $select_pet = "SELECT * FROM pet_infos WHERE user_ID = '$userID'";
    $select_order = "SELECT * FROM order_infos WHERE user_ID = '$userID'";
    $select_ordered = "SELECT * FROM order_history_infos WHERE user_ID = '$userID'";
    $select_msg = "SELECT * FROM msg_infos WHERE user_ID = '$userID'";

    if ($res_pet = mysqli_query($connect_DB, $select_pet)) {
        $pet_num = mysqli_num_rows($res_pet);
    } else {
        $pet_num = "查询出错" . $select_pet;
    }

    if ($res_order = mysqli_query($connect_DB, $select_order)) {
        $order_num = mysqli_num_rows($res_order);
    } else {
        $order_num = "查询出错" . $select_order;
    }

    if ($res_ordered = mysqli_query($connect_DB, $select_ordered)) {
        $ordered_num = mysqli_num_rows($res_ordered);
    } else {
        $ordered_num = "查询出错" . $select_ordered;
    }

    if ($res_msg = mysqli_query($connect_DB, $select_msg)) {
        $msg_num = mysqli_num_rows($res_msg);
    } else {
        $msg_num = "查询出错" . $select_msg;
    }
    echo "
    <table class='table'>
        <thead>
            <tr>
                <th scope='col'>信息分类</th>
                <th scope='col'>数据</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <th scope='row'>用户ID</th>
                <td>" . $userID . "</td>
            </tr>
            <tr>
                <th scope='row'>用户姓名</th>
                <td>" . $userName . "</td>
            </tr>
            <tr>
                <th scope='row'>默认联系方式</th>
                <td>" . $tel . "</td>
            </tr>
            <tr>
                <th scope='row'>登记宠物数量</th>
                <td>" . $pet_num . "</td>
            </tr>
            <tr>
                <th scope='row'>当前预约（条）</th>
                <td>" . $order_num . "</td>
            </tr>
            <tr>
                <th scope='row'>累计预约（次）</th>
                <td>" . $ordered_num . "</td>
            </tr>
            <tr>
                <th scope='row'>当前留言（条）</th>
                <td>" . $msg_num . "</td>
            </tr>
        </tbody>
    </table>";
}



$connect_DB->close();
?>